/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
/*
 * @Author: zhb
 * @Date: 2020-09-01
 * @Description: 定义const 变量(所有配置项表单的常量)
 */

// import {v4} from 'uuid';


/*eslint-disable*/
import sumForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/sum_form.vue'; //求和算子
import sortForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/sort_form.vue';
import timeStamp from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/time_stamp.vue';//时间戳算子
import filterForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/filter_form.vue';//普通过滤算子
import timeFilterForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/time_filter_form.vue'; //时间过滤算子
import missingValueForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/missing_value_form.vue'; //缺失值处理
import toggleCaseForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/toggle_case_form.vue'; //大小写转换
import stringConcatForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/string_concat_form.vue'; //字符串拼接
import getEmailForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/get_email_form.vue'; //提取邮箱算子

import aggForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/agg_form.vue'; //普通聚合算子
import timeAggForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/time_agg_from.vue'; //滑动窗口聚合算子
import smoothForm from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/smooth_form.vue' //平滑指数;
import timeSeries from 'src/home/mod_cluster/project_manager/feature_manager/component/form_list/time_series.vue'; //时序数据切分


//算子代号
const COMPONET_MARK = {
    'filter':{
        name:_('过滤'),
        type:filterForm,
        img:'filter',
        sign:'filter',
    },
    'orderBy':{
        name:_('排序'),
        type:sortForm,
        img:'opr',
        sign:'orderBy',
    },
    'timeTransform':{
        name:_('时间戳转换'),
        type:timeStamp,
        img:'timeStamp',
        sign:'timeTransform',
    },
    'sum':{
        name:_('求和'),
        type:sumForm,
        img:'opr',
        sign:'sum',
    },
    'aggregate':{
        name:_('普通聚合'),
        type:aggForm,
        img:'agg',
        sign:'aggregate',
    },
    'timeFilter':{
        name:_('时间过滤算子'),
        type:timeFilterForm,
        img:'filter',
        sign:'timeFilter',
    },
    'timeWindowSlideAgg':{
        name:_('滑动窗口聚合'),
        type:timeAggForm,
        img:'agg',
        sign:'timeWindowSlideAgg',
    },
    'nullValue':{
        name:_('缺失值处理'),
        type:missingValueForm,
        img:'outlier',
        sign:'nullValue',
    },
    // //暂未使用，该算子
    // '10':{
    //     name:_('无效值处理'),
    //     type:invalidValueForm,
    //     img:'outlier',
    //     sign:'10',
    // },
    'changeCase':{
        name:_('大小写转换'),
        type:toggleCaseForm,
        img:'stringOpr',
        sign:'changeCase',
    },
    'concatString':{
        name:_('字符串拼接'),
        type:stringConcatForm,
        img:'stringOpr',
        sign:'concatString',
    },
    'extractEmail':{
        name:_('提取邮箱'),
        type:getEmailForm,
        img:'outlier',
        sign:'extractEmail',
    },
    'smooth':{
        name:_('指数平滑'),
        type:smoothForm,
        img:'smooth',
        sign:'smooth',
    },
    'windowSlideSlice':{
        name:_('时序数据切分'),
        type:timeSeries,
        img:'timeSeries',
        sign:'windowSlideSlice',
    },
}



/** 全局的常量 */
const DEFAULT_WIDTH = 200;
const ADD_DEFAULT_WIDTH = 310;
const MAX_LENGTH = 100;

// ES数据集基础配置
const ES_DATA_SET_DEFAULT_DATA = {
    dataSourceId:'',
    index:'',
    sourceType:'',
    csvFilepath:'',
    url:"",
    csvFileEncoding:'UTF-8'
};

// // 本地数据集配置
// const LOCAL_DATA_SET_DEFAULT_DATA = {
//     data_source:''
// };

//求和算子配置
const SUM_DEFAULT_DATA = {
    newColumn:'',
    columns:[]
};

//排序算子配置
const SORT_DEFAULT_DATA = {
    column:'',
    order:true
};

//时间戳转换
const TIME_STAMP_DEFAULT_DATA = {
    "columnName" : "",
    "dateFormat" : "fromTimeStamp",
    "dstFormat" : "yyyy-MM-dd HH:mm:ss",
    "isNewColumnNeeded" : true,
    "timeProperty" : ""
};

//普通过滤算子配置
const NORMAL_FILTER_DATA = {
    conditions:{},
};

//时间过滤算子配置
const TIME_FILTER_DATA = {
    timeProperty:'',
    startDate:'',
    endDate:'',
    duration:-1
};



// 滑动聚合算子配置
const TIME_AGG_DATA = {
    "aggregationColumns" : [''],
    "aggregationOps" : [''],
    "endDate" : 1597130110302,
    "groupByKeys": [""],
    "startDate" : 1597130110302,
    "timeProperty" : "",
    windowSize:1,
    windowUnit:'hour',
    slide:1,
    slideUnit:"hour",
    duration:-1
};

//普通聚合算子
const NORMAL_AGG_DATA = {
    "aggregationColumns" : [''],
    "aggregationOps" : [''],
    "groupByKeys" : [''],
};

//算子时间单位
const TIME_UNIT_LIST = [{
    label:_('年'),
    value:'year'
}, {
    label:_('月'),
    value:'month'
}, {
    label:_('日'),
    value:'day'
}, {
    label:_('小时'),
    value:'hour'
}, {
    label:_('分钟'),
    value:'minute'
}, {
    label:_('秒'),
    value:'second'
}];

//算子时间单位
const UPDATA_TIME_UNIT_LIST = [{
    label:_('年'),
    value:'year'
}, {
    label:_('月'),
    value:'month'
}, {
    label:_('天'),
    value:'day'
}, {
    label:_('小时'),
    value:'hour'
}];

//算子操作单位
const OPR_UNIT_LIST = [{
    label:_('求和'),
    value:'sum'
}, {
    label:_('平均值'),
    value:'avg'
}, {
    label:_('最大值'),
    value:'max'
}, {
    label:_('最小值'),
    value:'min'
}, {
    label:_('标准差'),
    value:'std'
}];


//大小写转换
const TOGGLE_CASE_DATA = {
    method:'',
    fieldName:'',
    newColumn:''
};


const TOGGLE_CASE_TRANSFORM = [{
    label:_('字符串转大写'),
    value:'Upper'
},{
    label:_('字符串转小写'),
    value:'Lower'
},{
    label:_('字符串首字母大写'),
    value:'CapitalizeFirst'
}]


//字符串拼接
const STRING_CONCAT_DATA = {
    fieldList:[],
    newColumn:''
}

//提取邮箱算子
const GET_EMAIL_DATA = {
    extractColumn:[],
}

//缺失值处理
const MISSING_VALUE_FORM = {
    fieldName:'',
    method:'fill',
    fillMethod:''
}

const MISSING_FILL_METHOD = [{
    label:_('最大值'),
    value:'max'
},{
    label:_('最小值'),
    value:'min'
},{
    label:_('均值'),
    value:'avg'
}];

//无效值处理
const INVALID_VALUE_DATA = {
    fieldName:''
}

//平滑
const SMOOTH_DATA = {
    factors:['']//平滑因子大小
}

//时序数据切分
const TIME_SERIES_DATA = {
    window:'',
    slide:'',
    sliceColumn:'',
}

//特征算子集合
const FEATURE_OPERATE_LIST = [{
    title:_('基本操作'),
    collapsed:true,
    type:'sum',
    children:[{
        name:_('列求和'),
        component:sumForm,
        id:'05',
        type:'sum',
        operatorType:'sum',
        tips:_('选择任意个需要相加的数值型字段（仅支持数值型列对应元素按四则运算求和）。')
    }, {
        name:_('排序'),
        component:sortForm,
        id:'03',
        type:'sum',
        operatorType:'orderBy',
        tips:_('按指定字段对数据进行排序。')
    }]
}, {
    title:_('过滤'),
    collapsed:true,
    type:'filter',
    children:[{
        name:_('普通过滤'),
        component:filterForm,
        id:'02',
        type:'filter',
        operatorType:'filter',
        tips:_('支持创建多个过滤条件，并且条件之间需满足&&关系。')
    },{
        name:_('时间过滤'),
        component:timeFilterForm,
        id:'07',
        type:'filter',
        operatorType:'timeFilter',
        tips:_('日期时间选择过滤。')
    }]
}, {
    title:_('日期'),
    collapsed:true,
    type:'timeStamp',
    children:[{
        name:_('时间戳转换'),
        component:timeStamp,
        id:'04',
        type:'timeStamp',
        operatorType:'timeTransform',
        tips:_("实现不同时间格式之间的转换。")

    }]
}, {
    title:_('聚合'),
    collapsed:true,
    type:'agg',
    children:[{
        name:_('滑动窗口聚合'),
        component:timeAggForm,
        id:'08',
        type:'agg',
        operatorType:'timeWindowSlideAgg',
        tips:_('针对时序数据，先按照“滑动窗口”的方式把数据切分成N个时间片；再在每个切分后的时间片中，进行聚合统计分析。')
    },{
        name:_('普通聚合'),
        component:aggForm,
        id:'06',
        type:'agg',
        operatorType:'aggregate',
        tips:_('对需要的分组字段，进行聚合统计分析。')
    }]
}, {
    title:_('异常值处理'),
    collapsed:true,
    type:'outlier',
    children:[{
        name:_('缺失值处理'),
        component:missingValueForm,
        id:'09',
        type:'outlier',
        operatorType:'nullValue',
        tips:_('缺失值填充：支持使用最大值、最小值、均值填充缺失值（仅适用于数值型子段）。缺失值删除：选择缺失值的所在列，该列中全部无效值所在行的数据将被删除。')
    }]
    // ,{
    //     name:_('无效值处理'),
    //     component:invalidValueForm,
    //     id:'10',
    //     type:'outlier',
    //     tips:_('无效值删除：选择待处理列，删除该列中缺失值所在行的数据。')
    // }
}, {
    title:_('字符串处理'),
    collapsed:true,
    type:'stringOpr',
    children:[{
        name:_('大小写转换'),
        component:toggleCaseForm,
        id:'11',
        type:'stringOpr',
        operatorType:'changeCase',
        tips:_('支持对字符串进行转大写、转小写、首字母大写处理。')
    },{
        name:_('字符串拼接'),
        component:stringConcatForm,
        id:'12',
        type:'stringOpr',
        operatorType:'concatString',
        tips:_('按照所选字段的先后顺序作为字符串拼接的顺序。')
    }]
}, {
    title:_('时序数据处理'),
    collapsed:true,
    type:'timeSeries',
    children:[{
        name:_('指数平滑'),
        component:smoothForm,
        id:'14',
        type:'smooth',
        operatorType:'smooth',
        tips:_('对一维时序数据进行平滑处理，平滑因子越大，平滑效果越差。')
    },{
        name:_('时序数据切分'),
        component:timeSeries,
        id:'15',
        type:'timeSeries',
        operatorType:'windowSlideSlice',
        tips:_('将时序数据按照“滑动窗口”的方式切分成多个N个时间片。')
    }]
}, {
    title:_('邮箱处理'),
    collapsed:true,
    type:'outlier',
    children:[{
        name:_('邮箱处理'),
        component:getEmailForm,
        id:'13',
        type:'stringOpr',
        operatorType:'extractEmail',
        tips:_('从文本中提取标准的邮件格式数据。')
    }]
}];




export {
    ES_DATA_SET_DEFAULT_DATA,
    TIME_STAMP_DEFAULT_DATA,
    SUM_DEFAULT_DATA,
    SORT_DEFAULT_DATA,
    DEFAULT_WIDTH,
    ADD_DEFAULT_WIDTH,
    NORMAL_FILTER_DATA,
    TIME_FILTER_DATA,
    MAX_LENGTH,
    COMPONET_MARK,
    TOGGLE_CASE_TRANSFORM,
    TOGGLE_CASE_DATA,
    STRING_CONCAT_DATA,
    MISSING_VALUE_FORM,
    MISSING_FILL_METHOD,
    INVALID_VALUE_DATA,
    NORMAL_AGG_DATA,
    TIME_AGG_DATA,
    TIME_UNIT_LIST,
    UPDATA_TIME_UNIT_LIST,
    OPR_UNIT_LIST,
    SMOOTH_DATA,
    TIME_SERIES_DATA,
    GET_EMAIL_DATA,
    FEATURE_OPERATE_LIST
};
